//
//  Mineview.m
//  YTwallet
//
//  Created by ZhangLin on 2019/3/4.
//  Copyright © 2019年 hadrlog. All rights reserved.
//

#import "Mineview.h"
#import <Masonry.h>
@implementation Mineview

-(instancetype)initWithFrame:(CGRect)frame{
    if (self = [super initWithFrame:frame]) {
        [self setupViews];
    }
    return self;
}

-(void)setupViews{
    self.topView = [[UIView alloc] init];
    self.topView.backgroundColor = [UIColor whiteColor];
    [self addSubview:self.topView];
    [self.topView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(0);
        make.right.mas_equalTo(0);
        make.top.mas_equalTo(0);
        make.height.equalTo(self).multipliedBy(0.15);
    }];
    
    self.headerImv = [[UIImageView alloc] init];
    self.headerImv.image = [UIImage imageNamed:@"me_ic_head"];
    [self.topView addSubview:self.headerImv];
    [self.headerImv mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.equalTo(self.topView);
        make.left.mas_equalTo(15);
        make.width.mas_equalTo(56);
        make.height.mas_equalTo(56);
    }];
    
    //未登录UI
    self.noLoginView = [[UIView alloc] init];
    self.noLoginView.backgroundColor = [UIColor whiteColor];
    [self.topView addSubview:self.noLoginView];
    [self.noLoginView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.headerImv.mas_right).offset(10);
        make.right.mas_equalTo(0);
        make.top.equalTo(self.headerImv);
        make.height.equalTo(self.headerImv);
    }];
    

    self.loginOrRegisterBtn = [UIButton buttonWithType:(UIButtonTypeCustom)];
    [self.loginOrRegisterBtn setTitle:@"登录/注册" forState:(UIControlStateNormal)];
    [self.loginOrRegisterBtn setTitleColor:[UIColor colorWithRed:51 / 255.0 green:51 / 255.0 blue:51 / 255.0 alpha:1] forState:(UIControlStateNormal)];
    self.loginOrRegisterBtn.titleLabel.font = [UIFont boldSystemFontOfSize:18.0];
    [self.noLoginView addSubview:self.loginOrRegisterBtn];
    [self.loginOrRegisterBtn mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.headerImv.mas_right).offset(5);
        make.centerY.equalTo(self.headerImv);
    }];
    
    
    //已登录未实名
    self.loginSuccView = [[UIView alloc] init];
    self.loginSuccView.backgroundColor = [UIColor whiteColor];
    [self.topView addSubview:self.loginSuccView];
    [self.loginSuccView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.headerImv.mas_right).offset(10);
        make.right.mas_equalTo(0);
        make.top.equalTo(self.headerImv);
        make.height.equalTo(self.headerImv);
    }];
    
    self.loginSucphoneNumLab = [[UILabel alloc] init];
    self.loginSucphoneNumLab.textColor = [UIColor colorWithRed:153 / 255.0 green:153 / 255.0 blue:153 / 255.0 alpha:1];
    self.loginSucphoneNumLab.font = [UIFont systemFontOfSize:14.0];
    self.loginSucphoneNumLab.text = @"136****1212";
    [self.loginSuccView addSubview:self.loginSucphoneNumLab];
    [self.loginSucphoneNumLab mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(0);
        make.centerY.equalTo(self.headerImv);
    }];
    
    self.loginSuctoAutonymBtn = [UIButton buttonWithType:(UIButtonTypeCustom)];
    self.loginSuctoAutonymBtn.layer.cornerRadius = 15;
    self.loginSuctoAutonymBtn.backgroundColor = [UIColor colorWithRed:91 / 255.0 green:113 / 255.0 blue:255 / 255.0 alpha:1];
    [self.loginSuctoAutonymBtn setTitle:@"去实名认证" forState:(UIControlStateNormal)];
    [self.loginSuctoAutonymBtn setTitleColor:[UIColor whiteColor] forState:(UIControlStateNormal)];
    self.loginSuctoAutonymBtn.titleLabel.font = [UIFont systemFontOfSize:12];
    [self.loginSuccView addSubview:self.loginSuctoAutonymBtn];
    [self.loginSuctoAutonymBtn mas_makeConstraints:^(MASConstraintMaker *make) {
        make.right.mas_equalTo(-15);
        make.centerY.equalTo(self.loginSucphoneNumLab).offset(15);
        make.width.mas_equalTo(80);
        make.height.mas_equalTo(30);
    }];
    
    
    
    //已登录完成基础认证
    self.loginSuccAndBasicView = [[UIView alloc] init];
    self.loginSuccAndBasicView.backgroundColor = [UIColor whiteColor];
    [self.topView addSubview:self.loginSuccAndBasicView];
    [self.loginSuccAndBasicView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.headerImv.mas_right).offset(10);
        make.right.mas_equalTo(0);
        make.top.equalTo(self.headerImv);
        make.height.equalTo(self.headerImv);
    }];
    
    self.nameLab = [[UILabel alloc] init];
    self.nameLab.textColor = [UIColor colorWithRed:51 / 255.0 green:51 / 255.0 blue:51 / 255.0 alpha:1];
    self.nameLab.font = [UIFont boldSystemFontOfSize:18.0];
    self.nameLab.text = @"竹子";
    [self.loginSuccAndBasicView addSubview:self.nameLab];
    [self.nameLab mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(0);
        make.top.mas_equalTo(0);
    }];
    
    self.levelBtn = [UIButton buttonWithType:(UIButtonTypeCustom)];
    [self.levelBtn setTitle:@"等级" forState:(UIControlStateNormal)];
    [self.levelBtn setTitleColor:ETColorWithRGB(91, 113, 255) forState:(UIControlStateNormal)];
    self.levelBtn.titleLabel.font = [UIFont boldSystemFontOfSize:10];
    self.levelBtn.layer.borderColor = ETColorWithRGB(91, 113, 255).CGColor;
    self.levelBtn.layer.borderWidth = 1;
    self.levelBtn.layer.cornerRadius = 2;
    [self.loginSuccAndBasicView addSubview:self.levelBtn];
    [self.levelBtn mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.nameLab.mas_right).offset(8);
        make.centerY.equalTo(self.nameLab);
//        make.width.mas_equalTo(30);
        make.height.mas_equalTo(16);
    }];
    
    self.phoneNumLab = [[UILabel alloc] init];
    self.phoneNumLab.textColor = [UIColor colorWithRed:153 / 255.0 green:153 / 255.0 blue:153 / 255.0 alpha:1];
    self.phoneNumLab.font = [UIFont systemFontOfSize:14.0];
    self.phoneNumLab.text = @"136****1212";
    [self.loginSuccAndBasicView addSubview:self.phoneNumLab];
    [self.phoneNumLab mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(0);
        make.top.equalTo(self.nameLab.mas_bottom).offset(10);
    }];
    
    
    
    self.arrowBtn = [UIButton buttonWithType:(UIButtonTypeCustom)];
    [self.arrowBtn setImage:[UIImage imageNamed:@"me_icon_arrow_right"] forState:(UIControlStateNormal)];
    [self.loginSuccAndBasicView addSubview:self.arrowBtn];
    [self.arrowBtn mas_makeConstraints:^(MASConstraintMaker *make) {
        make.right.mas_equalTo(-15);
        make.centerY.equalTo(self.phoneNumLab);
        make.height.mas_equalTo(16);
        make.width.mas_equalTo(16);
    }];
    
    self.basicAuthenedBtn = [UIButton buttonWithType:(UIButtonTypeCustom)];
    [self.basicAuthenedBtn setTitle:@"已基础认证" forState:(UIControlStateNormal)];
    self.basicAuthenedBtn.titleLabel.font = [UIFont systemFontOfSize:14];
    [self.basicAuthenedBtn setTitleColor:ETColorWithRGB(153, 153, 153) forState:(UIControlStateNormal)];
    [self.loginSuccAndBasicView addSubview:self.basicAuthenedBtn];
    [self.basicAuthenedBtn mas_makeConstraints:^(MASConstraintMaker *make) {
        make.right.equalTo(self.arrowBtn.mas_left);
        make.centerY.equalTo(self.phoneNumLab);
    }];

    
    
    
}

@end
